from matplotlib import pyplot as plt, animation

from init import init
from simulation import Simulation


def update(frame, s: Simulation):
    print(frame)
    plt.cla()
    plt.axis([0, 10, 0, 10])
    return s.simulate()


if __name__ == '__main__':
    simulation = init()

    fig = plt.figure(figsize=[5, 5])
    ani = animation.FuncAnimation(fig, update, fargs=(simulation,), frames=10000, interval=10)
    plt.show()
